/**这里是专业洗车的接口 */
import request from "@/utils/request";

/**
 * 分页查询专业洗车页面的附近商户信息
 * @param {*} requestParams
 * @returns
 */
export function getMerchantListApi(requestParams) {
  //构建请求参数
  const params = Object.entries(requestParams || {})
    .filter(([key, value]) => value !== undefined)
    .map(
      ([key, value]) =>
        `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
    )
    .join("&");

  //构建url
  const url = params
    ? `/yueyang/merchant/list?${params}`
    : "/yueyang/merchant/list";

  return request({
    url: url,
    method: "Get",
  });
}

/**
 * 根据商户id查询 查询该商户提供的服务
 * @param {*} mid
 * @returns
 */
export function getServiceDetailsByMidApi(mid) {
  return request({
    url: `/yueyang/service-details?mid=${mid}`,
    method: "Get",
  });
}

/**
 * 分页指定商户的服务评价信息
 * @param {*} requestParams
 */
export function getEvaluationDataApi(requestParams) {
  return request({
    url: `/yueyang/service-details/evaluate/${requestParams.mid}?pageNum=${requestParams.pageNum}&pageSize=${requestParams.pageSize}`,
    method: "Get",
  });
}

/**
 *
 * @param {*} uid  根据用户id查询优惠券列表
 * @returns
 */
export function getCouponListApi(uid) {
  return request({
    url: `/yueyang/coupon/${uid}`,
    method: "Get",
  });
}

/**
 *
 * @param {*} uid  根据用户id查询该用户的车辆信息
 * @returns
 */
export function getCarInfoListApi(uid) {
  return request({
    url: `/yueyang/carInfo/${uid}`,
    method: "Get",
  });
}
